package com.voilet.interview.rx.operator.condition;

import android.util.Log;

import com.voilet.interview.rx.operator.absOperator;

import io.reactivex.Observable;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Predicate;

/**
 * Created by kan212 on 2019/4/10.
 */

public class all implements absOperator {
    @Override
    public void test() {

        Observable.just(1,2,3,4,5,6)
                .all(new Predicate<Integer>(){
                    @Override
                    public boolean test( Integer integer) throws Exception {
                        return (integer<=10);
                        // 该函数用于判断Observable发送的10个数据是否都满足integer<=10
                    }
                }).subscribe(new Consumer<Boolean>() {
            @Override
            public void accept(Boolean aBoolean) throws Exception {
                Log.d(TAG,"result is "+ aBoolean);
                // 输出返回结果
            }

        });


    }

    @Override
    public void test2() {

    }
}
